class Solution {
public:
    vector<int> findMissingAndRepeatedValues(vector<vector<int>>& grid)
    {
        int n = grid.size();
        vector<int> ans(2, 0);
        unordered_map<int, int> hash;
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
                hash[grid[i][j]]++;
        }
        for (int i = 1; i <= n * n; i++)
        {
            if (hash.find(i) == hash.end()) ans[1] = i;
            if (hash.find(i) != hash.end() && hash[i] > 1) ans[0] = i;
        }
        return ans;
    }//
};